import string
import enum
from random import choice


class ComplexityEnum(enum.IntEnum):
    """
    Enumeration that defines the complexity of the password
    """
    WEAK = 1
    MEDIUM = 2
    STRONG = 3


class PasswordGenerator:
    """
    A password generator class that generates password
    """
    @staticmethod
    async def generate(length: int, complexity: int, exclude: str = "") -> str:
        """
        Generates a password of specified length and complexity
        :param length: Password length
        :param complexity: Complexity of the password (1, 2, or 3)
        :param exclude: Characters to exclude from the password
        :return: Password of specified length and complexity as a string
        """
        if complexity == ComplexityEnum.WEAK:
            characters = string.ascii_letters + string.digits
        elif complexity == ComplexityEnum.MEDIUM:
            characters = string.ascii_letters + string.digits + string.punctuation
        elif complexity == ComplexityEnum.STRONG:
            characters = string.ascii_letters + string.digits + string.punctuation + string.ascii_uppercase
        else:
            raise ValueError("Invalid complexity level. Please choose from 1, 2, or 3.")

        for char in exclude:
            characters = characters.replace(char, '')

        password = ''.join(choice(characters) for _ in range(length))
        return password

